package cn.itcast.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @author 虎哥
 */
@Slf4j
//@Component
public class HelloJob {
    private boolean flag = true;

    @Scheduled(cron = "0/2 * * * * ?")
    public void job() throws InterruptedException {
        // 模拟任务执行耗时500ms

        log.warn("定时任务正在执行。");
//        if (flag) {
//            Thread.sleep(3000);
//            flag = false;
//        }
    }
}
